/**
 * 
 */
package net.toocruel.iqismart.dao.core;

import net.toocruel.iqismart.dao.base.BaseRepository;
import net.toocruel.iqismart.entity.common.Tag;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author toocruel
 *
 */
@org.springframework.stereotype.Repository
public interface TagRepository extends BaseRepository<Tag> {

    @Query(value = "select t.id as id,t.name as name,count(1) as count from question_tag qt join tag t on qt.tagId = t.id  group by tagId order by count desc limit ?1",nativeQuery = true)
    List<Object[]> getHotTags(int count);
}
